<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>C++ Web Framework: /home/herik/CPPWebFramework/CPPWebFramework/cwf/variant.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="logo.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">C++ Web Framework
   &#160;<span id="projectnumber">3.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_b2448bd9c6b97c57da490a507d179d6c.html">CPPWebFramework</a></li><li class="navelem"><a class="el" href="dir_3bacee99d34edff13677baafd8c3a47f.html">cwf</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">variant.h</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> Copyright 2017 Herik Lima de Castro and Marcelo Medeiros Eler</span></div><div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> Distributed under MIT license, or public domain if desired and</span></div><div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> recognized in your jurisdiction.</span></div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> See file LICENSE for detail.</span></div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment">*/</span></div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;</div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor">#ifndef VARIANT_H</span></div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#define VARIANT_H</span></div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;</div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#include &lt;QObject&gt;</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#include &lt;QVariant&gt;</span></div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &quot;cppwebframework_global.h&quot;</span></div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;</div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;CWF_BEGIN_NAMESPACE</div><div class="line"><a name="l00020"></a><span class="lineno"><a class="line" href="class_variant.html">   20</a></span>&#160;<span class="keyword">class </span>CPPWEBFRAMEWORKSHARED_EXPORT <a class="code" href="class_variant.html">Variant</a> : <span class="keyword">public</span> QObject</div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;{</div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;    Q_OBJECT</div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;    QVariant variant;</div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="keyword">public</span>:</div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;    <a class="code" href="class_variant.html">Variant</a>() = <span class="keywordflow">default</span>;</div><div class="line"><a name="l00032"></a><span class="lineno"><a class="line" href="class_variant.html#a1015564e64eb9bc9ce894fb1f98b6e36">   32</a></span>&#160;    <span class="keyword">explicit</span> <a class="code" href="class_variant.html#a1015564e64eb9bc9ce894fb1f98b6e36">Variant</a>(<span class="keywordtype">int</span> value) : variant(value) {}</div><div class="line"><a name="l00036"></a><span class="lineno"><a class="line" href="class_variant.html#a7e7d9a46e166e059ce75b76b92b11457">   36</a></span>&#160;    <span class="keyword">explicit</span> <a class="code" href="class_variant.html#a7e7d9a46e166e059ce75b76b92b11457">Variant</a>(<span class="keywordtype">double</span> value) : variant(value) {}</div><div class="line"><a name="l00040"></a><span class="lineno"><a class="line" href="class_variant.html#a6f86cea152e761f48700e41f210fe251">   40</a></span>&#160;    <span class="keyword">explicit</span> <a class="code" href="class_variant.html#a6f86cea152e761f48700e41f210fe251">Variant</a>(qlonglong value)  : variant(value) {}</div><div class="line"><a name="l00044"></a><span class="lineno"><a class="line" href="class_variant.html#a2a2d8b7cc035142a795f86d481adde0c">   44</a></span>&#160;    <span class="keyword">explicit</span> <a class="code" href="class_variant.html#a2a2d8b7cc035142a795f86d481adde0c">Variant</a>(<span class="keyword">const</span> QString &amp;value) : variant(value) {}</div><div class="line"><a name="l00048"></a><span class="lineno"><a class="line" href="class_variant.html#af11a005d444e0879b6a479bca786b19e">   48</a></span>&#160;    <span class="keyword">explicit</span> <a class="code" href="class_variant.html#af11a005d444e0879b6a479bca786b19e">Variant</a>(<span class="keyword">const</span> QByteArray &amp;value) : variant(QString(value)) {}</div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;<span class="keyword">public</span> slots:</div><div class="line"><a name="l00055"></a><span class="lineno"><a class="line" href="class_variant.html#a832bfdf3d791497b776c67b322fec871">   55</a></span>&#160;    <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="class_variant.html#a832bfdf3d791497b776c67b322fec871">toInt</a>(<span class="keywordtype">bool</span> *ok = <span class="keyword">nullptr</span>) const noexcept { <span class="keywordflow">return</span> variant.toInt(ok); }</div><div class="line"><a name="l00059"></a><span class="lineno"><a class="line" href="class_variant.html#ad1797f20d9396d3ddaf24b16453e3534">   59</a></span>&#160;    <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_variant.html#ad1797f20d9396d3ddaf24b16453e3534">setInt</a>(<span class="keywordtype">int</span> value) noexcept { variant = value; }</div><div class="line"><a name="l00064"></a><span class="lineno"><a class="line" href="class_variant.html#a17e4fd1648eb98fdc0a68302c392a216">   64</a></span>&#160;    <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="class_variant.html#a17e4fd1648eb98fdc0a68302c392a216">toDouble</a>(<span class="keywordtype">bool</span> *ok = <span class="keyword">nullptr</span>) const noexcept { <span class="keywordflow">return</span> variant.toDouble(ok); }</div><div class="line"><a name="l00068"></a><span class="lineno"><a class="line" href="class_variant.html#a6af0bb75e0612a13cb0880f0cec9a870">   68</a></span>&#160;    <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_variant.html#a6af0bb75e0612a13cb0880f0cec9a870">setDouble</a>(<span class="keywordtype">double</span> value) noexcept { variant = value; }</div><div class="line"><a name="l00073"></a><span class="lineno"><a class="line" href="class_variant.html#a4181b7ff9d27ae4936a6e91c9a9d7e26">   73</a></span>&#160;    <span class="keyword">inline</span> qlonglong <a class="code" href="class_variant.html#a4181b7ff9d27ae4936a6e91c9a9d7e26">toLongLong</a>(<span class="keywordtype">bool</span> *ok = <span class="keyword">nullptr</span>) const noexcept { <span class="keywordflow">return</span> variant.toLongLong(ok); }</div><div class="line"><a name="l00077"></a><span class="lineno"><a class="line" href="class_variant.html#a415098d546cf5f269de7ef5c5c438304">   77</a></span>&#160;    <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_variant.html#a415098d546cf5f269de7ef5c5c438304">setLongLong</a>(qlonglong value) noexcept { variant = value; }</div><div class="line"><a name="l00081"></a><span class="lineno"><a class="line" href="class_variant.html#a40530eedbdc0f3bad04df67febbc09de">   81</a></span>&#160;    <span class="keyword">inline</span> QString <a class="code" href="class_variant.html#a40530eedbdc0f3bad04df67febbc09de">toString</a>() const noexcept { <span class="keywordflow">return</span> variant.toString(); }</div><div class="line"><a name="l00085"></a><span class="lineno"><a class="line" href="class_variant.html#a0ca6fc641562de93db2490eb2a1e7d0e">   85</a></span>&#160;    <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="class_variant.html#a0ca6fc641562de93db2490eb2a1e7d0e">setString</a>(<span class="keyword">const</span> QString &amp;value) noexcept { variant = value; }</div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;};</div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;</div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;CWF_END_NAMESPACE</div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;</div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;<span class="preprocessor">#endif // VARIANT_H</span></div><div class="ttc" id="class_variant_html_a1015564e64eb9bc9ce894fb1f98b6e36"><div class="ttname"><a href="class_variant.html#a1015564e64eb9bc9ce894fb1f98b6e36">Variant::Variant</a></div><div class="ttdeci">Variant(int value)</div><div class="ttdoc">Constructs a new variant with an integer value. </div><div class="ttdef"><b>Definition:</b> variant.h:32</div></div>
<div class="ttc" id="class_variant_html_a7e7d9a46e166e059ce75b76b92b11457"><div class="ttname"><a href="class_variant.html#a7e7d9a46e166e059ce75b76b92b11457">Variant::Variant</a></div><div class="ttdeci">Variant(double value)</div><div class="ttdoc">Constructs a new variant with an double value. </div><div class="ttdef"><b>Definition:</b> variant.h:36</div></div>
<div class="ttc" id="class_variant_html"><div class="ttname"><a href="class_variant.html">Variant</a></div><div class="ttdoc">This class is designed to facilitate the passing of simple type parameters such as qlonglong...</div><div class="ttdef"><b>Definition:</b> variant.h:20</div></div>
<div class="ttc" id="class_variant_html_a2a2d8b7cc035142a795f86d481adde0c"><div class="ttname"><a href="class_variant.html#a2a2d8b7cc035142a795f86d481adde0c">Variant::Variant</a></div><div class="ttdeci">Variant(const QString &amp;value)</div><div class="ttdoc">Constructs a new variant with an QString value. </div><div class="ttdef"><b>Definition:</b> variant.h:44</div></div>
<div class="ttc" id="class_variant_html_a6af0bb75e0612a13cb0880f0cec9a870"><div class="ttname"><a href="class_variant.html#a6af0bb75e0612a13cb0880f0cec9a870">Variant::setDouble</a></div><div class="ttdeci">void setDouble(double value) noexcept</div><div class="ttdoc">Constructs a new variant with an double value. </div><div class="ttdef"><b>Definition:</b> variant.h:68</div></div>
<div class="ttc" id="class_variant_html_a0ca6fc641562de93db2490eb2a1e7d0e"><div class="ttname"><a href="class_variant.html#a0ca6fc641562de93db2490eb2a1e7d0e">Variant::setString</a></div><div class="ttdeci">void setString(const QString &amp;value) noexcept</div><div class="ttdoc">Constructs a new variant with an QString value. </div><div class="ttdef"><b>Definition:</b> variant.h:85</div></div>
<div class="ttc" id="class_variant_html_a17e4fd1648eb98fdc0a68302c392a216"><div class="ttname"><a href="class_variant.html#a17e4fd1648eb98fdc0a68302c392a216">Variant::toDouble</a></div><div class="ttdeci">double toDouble(bool *ok=nullptr) const noexcept</div><div class="ttdoc">Returns the variant as a double if the variant has userType() QMetaType::Double, QMetaType::Float, QMetaType::Bool, QMetaType::QByteArray, QMetaType::Int, QMetaType::LongLong, QMetaType::QString, QMetaType::UInt, or QMetaType::ULongLong; otherwise returns 0.0. </div><div class="ttdef"><b>Definition:</b> variant.h:64</div></div>
<div class="ttc" id="class_variant_html_a40530eedbdc0f3bad04df67febbc09de"><div class="ttname"><a href="class_variant.html#a40530eedbdc0f3bad04df67febbc09de">Variant::toString</a></div><div class="ttdeci">QString toString() const noexcept</div><div class="ttdoc">Returns the variant as a QString if the variant has userType() QMetaType::QString, QMetaType::Bool, QMetaType::QByteArray, QMetaType::QChar, QMetaType::QDate, QMetaType::QDateTime, QMetaType::Double, QMetaType::Int, QMetaType::LongLong, QMetaType::QStringList, QMetaType::QTime, QMetaType::UInt, or QMetaType::ULongLong; otherwise returns an empty string. </div><div class="ttdef"><b>Definition:</b> variant.h:81</div></div>
<div class="ttc" id="class_variant_html_ad1797f20d9396d3ddaf24b16453e3534"><div class="ttname"><a href="class_variant.html#ad1797f20d9396d3ddaf24b16453e3534">Variant::setInt</a></div><div class="ttdeci">void setInt(int value) noexcept</div><div class="ttdoc">Constructs a new variant with an int value. </div><div class="ttdef"><b>Definition:</b> variant.h:59</div></div>
<div class="ttc" id="class_variant_html_a832bfdf3d791497b776c67b322fec871"><div class="ttname"><a href="class_variant.html#a832bfdf3d791497b776c67b322fec871">Variant::toInt</a></div><div class="ttdeci">int toInt(bool *ok=nullptr) const noexcept</div><div class="ttdoc">Returns the variant as an int if the variant has userType() QMetaType::Int, QMetaType::Bool, QMetaType::QByteArray, QMetaType::QChar, QMetaType::Double, QMetaType::LongLong, QMetaType::QString, QMetaType::UInt, or QMetaType::ULongLong; otherwise returns 0. </div><div class="ttdef"><b>Definition:</b> variant.h:55</div></div>
<div class="ttc" id="class_variant_html_af11a005d444e0879b6a479bca786b19e"><div class="ttname"><a href="class_variant.html#af11a005d444e0879b6a479bca786b19e">Variant::Variant</a></div><div class="ttdeci">Variant(const QByteArray &amp;value)</div><div class="ttdoc">Constructs a new variant and converts to QString. </div><div class="ttdef"><b>Definition:</b> variant.h:48</div></div>
<div class="ttc" id="class_variant_html_a415098d546cf5f269de7ef5c5c438304"><div class="ttname"><a href="class_variant.html#a415098d546cf5f269de7ef5c5c438304">Variant::setLongLong</a></div><div class="ttdeci">void setLongLong(qlonglong value) noexcept</div><div class="ttdoc">Constructs a new variant with an qlonglong value. </div><div class="ttdef"><b>Definition:</b> variant.h:77</div></div>
<div class="ttc" id="class_variant_html_a4181b7ff9d27ae4936a6e91c9a9d7e26"><div class="ttname"><a href="class_variant.html#a4181b7ff9d27ae4936a6e91c9a9d7e26">Variant::toLongLong</a></div><div class="ttdeci">qlonglong toLongLong(bool *ok=nullptr) const noexcept</div><div class="ttdoc">Returns the variant as a long long int if the variant has userType() QMetaType::LongLong, QMetaType::Bool, QMetaType::QByteArray, QMetaType::QChar, QMetaType::Double, QMetaType::Int, QMetaType::QString, QMetaType::UInt, or QMetaType::ULongLong; otherwise returns 0. </div><div class="ttdef"><b>Definition:</b> variant.h:73</div></div>
<div class="ttc" id="class_variant_html_a6f86cea152e761f48700e41f210fe251"><div class="ttname"><a href="class_variant.html#a6f86cea152e761f48700e41f210fe251">Variant::Variant</a></div><div class="ttdeci">Variant(qlonglong value)</div><div class="ttdoc">Constructs a new variant with an qlonglong value. </div><div class="ttdef"><b>Definition:</b> variant.h:40</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Mon May 28 2018 11:09:08 for C++ Web Framework by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>
